import React, { memo , useRef ,} from 'react'
//通过 ref 获取 DOM 
const Contenter = memo((props) => {
  const h1Ref = useRef()
  const h2Ref = useRef()
  function getDomcontent(){
    console.log('123');
    console.log(h1Ref.current)
    console.log(h2Ref.current);
    console.log(this);
  };
  return (
    <div style={{border:'1px solid #491dc3',height:'150px'}}>Contenter
      <h1 ref={h1Ref} >这里是DOM内容</h1>
      <h2 ref={h2Ref}>这里是有内容的h2</h2>
      <button onClick={()=>getDomcontent()}>获取DOM</button>
    </div>
  )
})


export default Contenter